<?php

/**
 * Created by PhpStorm.
 * User: li
 * Date: 15-10-18
 * Time: 下午11:20
 */
class Comment extends MY_Action_Controller
{
    function __construct(){
        parent::__construct();
    }

    /**
     *  对订单进行评价   POST  ALL
     *
     */
    function order(){
        $order_id   =   trim($this->input->post('order_id'));
        $activity_id    =   intval($this->input->post('activity_id'));
        $rank       =   floatval($this->input->post('rank'));
        $message    =   $this->input->post('message');
        if(empty($message))
            $message    =   '无评价信息';
        if(!$order_id or $activity_id<0 or $rank<0 or $rank>5)
            $this->set_response(10800);
        $data = array(
            'order_id'  =>  $order_id,
            'user_id'   =>  $this->_login_user['user_id'],
            'activity_id'   =>  $activity_id,
            'rank'      =>  $rank,
            'message'   =>  $message,
            'created'   =>  date('Y-m-d H:i:s',time())
        );
        $this->load->model('activities/Activity_comment');
        if(!$this->Activity_comment->insert($data))
            $this->set_response(30001);
        $this->set_response(0);
    }
    /**
     *  对旅游
     *

    function trip(){

    }*/
    /**
     * 对本站
     *

    function site(){

    }*/
}